//
// Created by 李康 on 15/12/9.
//

#ifndef DNS_MINING_APRIORIIMPL_H
#define DNS_MINING_APRIORIIMPL_H

#include <iostream>
#include <set>
#include <map>
#include <fstream>
typedef std::set<std::string> ItemSet;
typedef std::set<ItemSet> SuperItemSet;

typedef ItemSet::iterator ItemSetIter;
typedef SuperItemSet::iterator SuperItemSetIter;

//generate large(frequent) 1-itemset
SuperItemSet genL1(const std::string inputfilename, std::map<ItemSet, int> &FreItemSupport, const int min_sup);
SuperItemSet scanDB(const std::string inputfilename, const SuperItemSet &Candidate, std::map<ItemSet, int> &FreItemSupport, const int min_sup);
//calculate support
std::map<ItemSet, int> calSupport(const std::string inputfilename, const SuperItemSet &Candidate);
//generate k-itemsets candidate from k-1 frequent itemsets
SuperItemSet genCk(const SuperItemSet &freItemSet);
bool hasInfrequent(const ItemSet &itemSet, const SuperItemSet &FreItemSet);
SuperItemSet genSubSets(const ItemSet &itemSet);
void showRule(std::ofstream &outfile, const SuperItemSet &FreItemSet, std::map<ItemSet, int> &FreItemSupport, const double min_con);
#endif //DNS_MINING_APRIORIIMPL_H
